const filterHandle = (vm, h, params, demo) => {
  return h("div", [
    h(
      "Button",
      {
        props: {
          type: "primary",
          size: "small",
          disabled: demo || params.row.name == "长沙平和堂五一广场店"
        },
        style: {
          marginRight: "5px"
        },
        on: {
          click: _ => {
            const row = { ...params.row };
            vm.handleEdit(row);
          }
        }
      },
      "编辑"
    ),
    h(
      "Poptip",
      {
        props: {
          confirm: true,
          title: "您确定要删除这条数据吗?",
          transfer: true,
          cancelText: "取消"
        },
        on: {
          "on-ok": () => {
            const row = { ...params.row };
            vm.handleDelete(row);
          }
        }
      },
      [
        h(
          "Button",
          {
            style: {
              marginRight: "5px"
            },
            props: {
              type: "error",
              size: "small",
              disabled: demo || params.row.name == "长沙平和堂五一广场店"
            }
          },
          "删除"
        )
      ]
    )
  ]);
};
export const paramsColumns = (vm, demo) => {
  return [
    {
      title: "设备类型",
      align: "center",
      key: "typeName"
    },
    {
      title: "创建时间",
      align: "center",
      render: (h, params) =>
        h("span", vm.moment(params.row.createdAt).format("YYYY-MM-DD HH:mm:ss"))
    },
    {
      title: "更新时间",
      align: "center",
      render: (h, params) =>
        h("span", vm.moment(params.row.updatedAt).format("YYYY-MM-DD HH:mm:ss"))
    },
    {
      title: "操作",
      align: "center",
      render: (h, params) => filterHandle(vm, h, params, demo)
    }
  ];
};
